/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.hyjiacan.deadqq.client.window;

import java.awt.event.ActionEvent;

import javax.swing.JFrame;

import org.hyjiacan.deadqq.common.entity.User;
import org.hyjiacan.deadqq.common.util.WindowUtil;


/**
 * 用户详细信息查看窗口，如果是登录用户则可以编辑信息内容，如果是查看联系人（好友）的信息则只能查看，以后可能会添加备注信息的功能
 * 
 * @author hyjiacan
 */
public class ProfileView extends JFrame implements Runnable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2111604298353765135L;
	private User user;

	/**
	 * Creates new form ProfileView
	 */
	public ProfileView() {
	}

	public ProfileView(User user) {
		this.user = user;
	}

	@Override
	public void run() {
		initComponents();
		WindowUtil.center(this);
		this.setVisible(true);
		WindowManager.put(this.getClass().getName() + "-" + user.getNumber(),
				this);
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	// <editor-fold defaultstate="collapsed"
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        gender = new javax.swing.ButtonGroup();
        avatar = new javax.swing.JLabel();
        accountlb = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        nicknamelb = new javax.swing.JLabel();
        nickname = new javax.swing.JTextField();
        levellb = new javax.swing.JLabel();
        level = new javax.swing.JLabel();
        realnamelb = new javax.swing.JLabel();
        realname = new javax.swing.JTextField();
        genderlb = new javax.swing.JLabel();
        settingpanel = new javax.swing.JPanel();
        male = new javax.swing.JRadioButton();
        female = new javax.swing.JRadioButton();
        birthdaylb = new javax.swing.JLabel();
        birthday = new javax.swing.JTextField();
        Signature = new javax.swing.JTextArea();
        addContact = new javax.swing.JButton();
        close = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        avatar.setBackground(new java.awt.Color(255, 255, 255));
        avatar.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("com.hyjiacan.xx.client.i18n.en_US"); // NOI18N
        accountlb.setText(bundle.getString("ACCOUNT")); // NOI18N

        nicknamelb.setText(bundle.getString("NICK NAME")); // NOI18N

        levellb.setText(bundle.getString("LEVEL")); // NOI18N

        level.setText("2");

        realnamelb.setText(bundle.getString("REAL NAME")); // NOI18N

        genderlb.setText(bundle.getString("GENDER")); // NOI18N

        settingpanel.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("SETTINGS"))); // NOI18N

        javax.swing.GroupLayout settingpanelLayout = new javax.swing.GroupLayout(settingpanel);
        settingpanel.setLayout(settingpanelLayout);
        settingpanelLayout.setHorizontalGroup(
            settingpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        settingpanelLayout.setVerticalGroup(
            settingpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 118, Short.MAX_VALUE)
        );

        male.setText(bundle.getString("MALE")); // NOI18N

        female.setText(bundle.getString("FEMALE")); // NOI18N

        birthdaylb.setText(bundle.getString("BIRTHDAY")); // NOI18N

        birthday.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                birthdayActionPerformed(evt);
            }
        });

        Signature.setColumns(20);
        Signature.setRows(3);
        Signature.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("SIGNATURE"))); // NOI18N

        addContact.setText("Add");

        close.setText("Close");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(Signature)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(avatar, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(13, 13, 13)
                                        .addComponent(accountlb)
                                        .addGap(18, 18, 18)
                                        .addComponent(jTextField1))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(nicknamelb)
                                        .addGap(18, 18, 18)
                                        .addComponent(nickname, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(realnamelb)
                                        .addGap(18, 18, 18)
                                        .addComponent(realname)))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(genderlb)
                                            .addComponent(levellb))
                                        .addGap(18, 18, 18)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(level, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(male)
                                                .addGap(18, 18, 18)
                                                .addComponent(female))))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(birthdaylb)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(birthday))))
                            .addComponent(settingpanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(addContact, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(close, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(avatar, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(accountlb)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(levellb)
                            .addComponent(level))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(nickname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(nicknamelb)
                            .addComponent(genderlb)
                            .addComponent(male)
                            .addComponent(female))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(realnamelb)
                            .addComponent(realname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(birthdaylb)
                            .addComponent(birthday, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(Signature, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(settingpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(addContact)
                    .addComponent(close))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        settingpanel.getAccessibleContext().setAccessibleName(bundle.getString("SETTINGS")); // NOI18N

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void birthdayActionPerformed(ActionEvent evt) {// GEN-FIRST:event_birthdayActionPerformed
	// JDatePanelImpl p = new JDatePanelImpl(null);
	// JDatePicker date = new JDatePickerImpl(p);
	// Thread t = new Thread(date);
	}// GEN-LAST:event_birthdayActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea Signature;
    private javax.swing.JLabel accountlb;
    private javax.swing.JButton addContact;
    private javax.swing.JLabel avatar;
    private javax.swing.JTextField birthday;
    private javax.swing.JLabel birthdaylb;
    private javax.swing.JButton close;
    private javax.swing.JRadioButton female;
    private javax.swing.ButtonGroup gender;
    private javax.swing.JLabel genderlb;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JLabel level;
    private javax.swing.JLabel levellb;
    private javax.swing.JRadioButton male;
    private javax.swing.JTextField nickname;
    private javax.swing.JLabel nicknamelb;
    private javax.swing.JTextField realname;
    private javax.swing.JLabel realnamelb;
    private javax.swing.JPanel settingpanel;
    // End of variables declaration//GEN-END:variables
}
